package svc

import (
	"book/service/sstwords/cmd/rpc/internal/config"
	"book/service/sstwords/model"

	"github.com/tal-tech/go-zero/core/stores/sqlx"
)

type ServiceContext struct {
	Config        config.Config
	SstWordsModel model.SstWordsModel
}

func NewServiceContext(c config.Config) *ServiceContext {
	conn := sqlx.NewMysql(c.Mysql.DataSource)
	return &ServiceContext{
		Config:        c,
		SstWordsModel: model.NewSstWordsModel(conn, c.CacheRedis),
	}
}
